﻿	{if $type == 'topic'}
		<script type="text/javascript" src="{$APP_URL}/js/bbeditor/ed.js"></script>
		<div id="content">
			<div id="topic_preview" class="rounded">
				<div class="head">ตัวอย่าง</div>
				<div class="body"></div>
			</div>
			<div class="topicform">
				<div class="content">
					<fieldset>
						<legend>{$pagetitle}</legend>
						<form action="{$APP_URL}/topic" method="POST" name="edittopic" id="edittopic">
							<label for="topic_title" class="inlined">หัวเรื่อง</label>
							<input type="text" class="input-text validate['required']" name="topic_title" id="topic_title" size="80" value="{$topics.topic_title}" />
							<label>ไอคอนกระทู้</label>
							<div style="padding:5px 0;">
							{foreach from=$icons key=k item=i}
								<span style="margin-right:5px;"><input type="radio" name="topic_icon" value="{$k}"{if $k == $topics.topic_icon} checked="checked"{/if}> <img src="{$APP_URL}/images/icons/topic/{$i}.png" /></span>
							{/foreach}
							</div>
							<script type="text/javascript">edToolbar('topic_text', 'emos');</script>
							<div id="emos" class="emoticon">
								{foreach from=$emos key=txt item=img}<a href="javascript:void(0);" onclick="replaceText('{$txt}', $('topic_text'));$('emos').setStyle('display', 'none')">{$img}</a>{/foreach}
							</div>
							<label for="topic_text" class="inlined">ข้อความ</label>
							<textarea name="topic_text" id="topic_text" class="input-text validate['required']" cols="100" rows="20">{$topics.topic_text}</textarea>
							<button type="submit" class="super secondary small submit">บันทึก</button>
							<button class="super secondary small" id="preview-btn">แสดงตัวอย่าง</button>
							<button type="reset" class="super secondary small">ยกเลิก</button>
							<input type="hidden" name="session" value="{$user.session_id}" />
							<input type="hidden" name="id" value="{$topics.topic_id}">
							<input type="hidden" name="action" value="edit">
						</form>
					</fieldset>
				</div>
			</div>
			<div style="clear: both;">&nbsp;</div>			
		</div>
		<!-- end #content -->
	{literal}
		<script type="text/javascript">
		window.addEvent('domready', function(){
			preview_init('preview-btn', 'topic_text', 'topic_preview', APP.TOKEN);
			new FormCheck('newtopic', {'trimValue': true});
		});
		</script>
	{/literal}		
	{/if}
	{if $type == 'post'}
		<script type="text/javascript" src="{$APP_URL}/js/bbeditor/ed.js"></script>
		<div id="content">
			<div id="topic_preview" class="rounded">
				<div class="head">ตัวอย่าง</div>
				<div class="body"></div>
			</div>		
			<div class="topicform">
				<div class="content">
					<fieldset>
						<legend>{$pagetitle}</legend>
						<form action="{$APP_URL}/post" method="POST" name="editpost" id="editpost">
							<script type="text/javascript">edToolbar('post_text', 'emos');</script>
							<div id="emos" class="emoticon">
								{foreach from=$emos key=txt item=img}<a href="javascript:void(0);" onclick="replaceText('{$txt}', $('post_text'));$('emos').setStyle('display', 'none')">{$img}</a>{/foreach}
							</div>
							<label for="post_text" class="inlined">ข้อความ</label>
							<textarea name="post_text" id="post_text" class="input-text validate['required']" cols="100" rows="20">{$posts.post_text}</textarea>
							<button type="submit" class="super secondary small">บันทึก</button>
							<button class="super secondary small" id="preview-btn">แสดงตัวอย่าง</button>
							<button type="reset" class="super secondary small">ยกเลิก</button>
							<input type="hidden" name="session" value="{$user.session_id}" />
							<input type="hidden" name="id" value="{$posts.post_id}">
							<input type="hidden" name="action" value="edit">
						</form>
					</fieldset>
				</div>
			</div>
			<div style="clear: both;">&nbsp;</div>			
		</div>
		<!-- end #content -->
	{literal}
		<script type="text/javascript">
		window.addEvent('domready', function(){
			preview_init('preview-btn', 'post_text', 'topic_preview', APP.TOKEN);
			new FormCheck('newtopic', {'trimValue': true});
		});
		</script>
	{/literal}	
	{/if}